<template>
  <div id="app">
    <!-- 顶部放header -->
    <mt-header fixed title="资讯商城">
         <router-link to="/" slot="left">
        <mt-button icon="back">返回</mt-button>
      </router-link>
    </mt-header>
    <!-- 中间放router-view -->
   <transition><router-view></router-view></transition>
    <!-- 底部放tab -->
    <nav class="mui-bar mui-bar-tab">
      <router-link class="mui-tab-item " to="/home">
        <span class="mui-icon mui-icon-home"></span>
        <span class="mui-tab-label">首页</span>
      </router-link>
      <router-link class="mui-tab-item" to="/member">
        <span class="mui-icon mui-icon-contact mui-icon-icon-contact-filled"></span>
        <span class="mui-tab-label">会员</span>
      </router-link>
      <router-link class="mui-tab-item" to="/cart">
        <span class=" mui-icon mui-icon-extra mui-icon-extra-cart">
          <span class="mui-badge" id="badge">{{this.$store.getters.optNum}}</span></span>
        <span class="mui-tab-label">购物车</span>
      </router-link>
      <router-link class="mui-tab-item" to="/search">
        <span class="mui-icon mui-icon-search"></span>
        <span class="mui-tab-label">搜索</span>
      </router-link>
    </nav>
  </div>
</template>

<script>


export default {
  name: 'App',
  data:function(){return{}},
  methods:{
    goback(){
      this.$router.go(-1);
    }
  }

}
</script>

<style scoped lang="scss">
#app {
  padding-top: 40px;
  padding-bottom: 50px;
/*router-view的切换，组件容器切换的动画效果*/
.v-enter{
  transform: translateX(100%);
  opacity: 0;
}
.v-leave-to{
   transform: translateX(-100%);
  opacity: 0;
}

.v-enter-active,.v-leave-active{
  transition: all 0.5s ease;
  position: absolute; 
  /*防止router-view的内容的移动*/
  overflow: hidden;
}
.mint-header{
  z-index:99;
  
    .back{
      color:white;

    }
  }
}
</style>
